<template>
  <div id="app">
    <HeaderComponent :header_data="header_data"/>
    <div class="tab">
      <div class="tab-item">
        <router-link to="/goods">商品</router-link>
      </div>
      <div class="tab-item">
        <router-link to="/ratings">评论</router-link>
      </div>
      <div class="tab-item">
        <router-link to="/seller">商家</router-link>
      </div>
    </div>
    <router-view/>
  </div>
</template>

<script>
import HeaderComponent from "./components/header/Header.vue";

export default {
  name: "app",
  data() {
    return {
      header_data: {}
    };
  },
  created() {
    this.axios
      .get("http://192.168.1.3:8080/data")
      .then(res => {
          this.header_data = res.data.seller;
          // eslint-disable-next-line
          console.log(res.data.seller);
      })
      .catch(error => {
        // eslint-disable-next-line
        console.log(error);
      });
  },
  components: {
    HeaderComponent
  }
};
</script>

<style lang="scss">
.tab {
  display: flex;
  width: 100%;
  height: 40px;
  line-height: 40px;

  .tab-item {
    flex: 1;
    text-align: center;
    & > a {
      display: block;
      font-size: 14px;
      color: rgb(77, 85, 93);
      &.router-link-active {
        color: rgb(240, 20, 20);
      }
    }
  }
}
</style>
